Skip to content

Conversation

@jwage
Copy link
Member

@jwage jwage commented Apr 30, 2019

Q A
Type improvement
BC Break no
Fixed issues fixes #3531

Summary

Improve consistency of exception message formatting. See #3531 for details.

TODO

  • Add tests for exceptions that weren't tested.

@jwage jwage added this to the 3.0.0 milestone Apr 30, 2019
@jwage jwage marked this pull request as ready for review April 30, 2019 02:25
@jwage jwage requested a review from morozov April 30, 2019 03:19
@morozov
Copy link
Member

morozov commented Apr 30, 2019

@jwage please see the comments above. I haven't reviewed the entire patch yet.

public function closeCursor() : void
{
unset($this->data);
$this->data = null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was adding tests for ArrayStatement and this seemed wrong since it can result in PHP errors if you call other public methods after closeCursor()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes perfect sense.


if (isset($this->connectionParameters[$shard['id']])) {
throw new InvalidArgumentException('Shard ' . $shard['id'] . ' is duplicated in the configuration.');
throw new InvalidArgumentException(sprintf('Shard "%s" is duplicated in the configuration.', $shard['id']));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is $shard['id'] a string?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's annotated as int|string in most places but looks like it's a numeric string (or an integer):

if (! is_numeric($shard['id']) || $shard['id'] < 1) {
throw new InvalidArgumentException('Shard Id has to be a non-negative number.');
}

Also, the id comes from sys.federation_member_distributions.member_id:

$sql = 'SELECT member_id as id,
distribution_name as distribution_key,
CAST(range_low AS CHAR) AS rangeLow,
CAST(range_high AS CHAR) AS rangeHigh
FROM sys.federation_member_distributions d
INNER JOIN sys.federations f ON f.federation_id = d.federation_id
WHERE f.name = ' . $this->conn->quote($this->federationName);

which according to this article is INT.

These details are mostly for myself, I'll need this info later to finish the work on strict types.

@morozov
Copy link
Member

morozov commented May 6, 2019

@jwage I rebased develop yesterday to accommodate recent conflicting changes from master. Please rebase.

@jwage
Copy link
Member Author

jwage commented May 7, 2019

@morozov Done!

return new self(
sprintf(
"Option 'platform' must be an object and subtype of '%s'. Got '%s'",
'Option "platform" must be an object and subtype of %s. Got "%s".',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quotes around type needed.


throw new UnexpectedValueException("Unrecognized boolean literal '${value}'");
throw new UnexpectedValueException(sprintf(
'Unrecognized boolean literal, "%s" given.',
Copy link
Member

@morozov morozov May 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quotes around type needed. Or… most likely it will be a printable scalar value. Let's leave it without the GetVariableType.

@morozov
Copy link
Member

morozov commented May 7, 2019

@jwage thanks. Could you look at the build failure and the new comments? Looks like we're really close to finishing it.

@jwage
Copy link
Member Author

jwage commented May 7, 2019

Fixed latest feedback and fixed the tests.

@morozov morozov merged commit c7cb259 into doctrine:develop May 8, 2019
@morozov
Copy link
Member

morozov commented May 8, 2019

Thank you 🚢

@morozov morozov self-assigned this May 8, 2019
@jwage
Copy link
Member Author

jwage commented May 8, 2019

Cool! Thanks!

morozov added a commit that referenced this pull request May 23, 2019
Improve consistency of exception message formatting.
@morozov morozov removed the WIP label May 23, 2019
morozov added a commit to morozov/dbal that referenced this pull request May 31, 2019
Improve consistency of exception message formatting.
morozov added a commit to morozov/dbal that referenced this pull request May 31, 2019
Improve consistency of exception message formatting.
morozov added a commit that referenced this pull request Jun 13, 2019
Improve consistency of exception message formatting.
morozov added a commit that referenced this pull request Jun 27, 2019
Improve consistency of exception message formatting.
morozov added a commit that referenced this pull request Jun 27, 2019
Improve consistency of exception message formatting.
morozov added a commit that referenced this pull request Jun 27, 2019
Improve consistency of exception message formatting.
morozov added a commit to morozov/dbal that referenced this pull request Aug 26, 2019
Improve consistency of exception message formatting.
morozov added a commit to morozov/dbal that referenced this pull request Aug 27, 2019
Improve consistency of exception message formatting.
morozov added a commit that referenced this pull request Nov 2, 2019
Improve consistency of exception message formatting.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants